Online IVR Tutorial
Variables


All variables in the Xtend IVR scripting language starts with a '$' sign. Variable names are not case sensitive and should be composed of an initial letter followed by combinations of letters, numbers and underscore. The standard convention is to use a combination of upper and lower case characters for the variable names.

Example

$Login = "Testing"
$MaxTries = 10

Remarks

There are certain pre-defined (reserved) variables, which the user should not modify. The values contained in these variables are changed by Xtend IVR itself and contain information regarding the origin of the call and the state of execution of the script. These variables are:

 
$AppPath : Gives the path where Xtend IVR is installed.
$CallType : Type of call - Normal, Redirect, RedirectBusy, RedirectNoReply or RedirectUncondititional.
$Cli : The caller line identification that was received.
$Date : The current date expressed as dd/mm/yyyy.
$Debug : Will be 1 if running under Developer mode and 0 if running under Standard mode.
$DecimalPrecision : Sets the precision for all floating point numbers used by Xtend IVR.
$DeviceId : A unique ID for each incoming line.
$DeviceName : Name of the currently active channel/port in the voice driver.
$DisplayPrefix : The contents of this variable will be automatically added to all the display commands.
$Dli : Device Line Identification.
$DriverName : Name of the Voice driver used.
$Error : Contains the error messages if any from the previous operation.
$ExitCode : The exit code of program executed by the last RUN command.
$InputMode : Mode of Input - Pulse, Tone or Speech Recognition.
$LastKey : The last key pressed by the user.
$LogFile : Name of the active Log file.
$PluginParamCount : Number of arguments to the Plugin.
$PluginReturn : Return value from the Plugin.
$RecordFile : Path of the recorded file.
$Ring : The number of times the phone has rung.
$Rli : Redirect line Identification when the call is diverted.
$ScriptFile : The name of the script.
$Time : The current time expressed as hh:mm:ss.
$Timeout : The amount of time remaining for script termination.
$VarFile : The name of parameter file containing the list of variables. 
$WavDir : Content of variable gives the wav file directory if not found in any of the current directory, ivr directory, wave directory or in the script directory.
$WavPass : Password of the encrypted wave file.
$XivrVer : Content gives the version of Xtend IVR. 

Following arithmetic operations are possible. Expression containing more than one arithmetic operator are however not currently supported.

$A += 1
$B -= 1
$C = $A + $B
$C = $A - $B
$C = $A * $B
$C = $A / $B

Following string operations are possible. For detailed information about the built-in functions please refer Functions.

$A = "ABCDEF"
$B = len($A)
$C = mid($A,1,1)
$A = "Try"
$B = "This"
$C = concat($A,$B)

Variables can be used at any point where a string or numeric literal is required. Other than this, variables are also supported by an IF statement which allows branching based on the result of the comparison. All variable values including numbers are internally stored as strings and therefore all string operations can also be implemented on numbers and will have the expected results. When dealing with variables following points should be noted.

$A = 650
$B = "200XYZ"
$C = $A + $B will result in $C having the value 850.
$A = 650
$B = "XYZ200"
$C = $A + $B will result in $C having the value 650.
Boolean Values

Booleans are used to denote the result of a logical operation. It is the logic that computers use to determine if a statement is true or false. A boolean can be either TRUE or FALSE.

A bool value can be promoted to an integral type. A bool value of TRUE is promoted to the value 1, whereas a boolean value of FALSE is promoted to the value 0.

The result of the equality, relational and logical operators is either of the boolean constants true or false.

Xtend IVR facilitates to check a boolean value in loops and conditional statements as shown below: